package com.tchintech.pay.view.certification;

import android.view.View;

import com.tchintech.pay.R;
import com.tchintech.pay.delegate.certification.AuthenticationDelegate;
import com.tchintech.pay.frame.presenter.ActivityPresenter;
import com.tchintech.pay.model.entity.HttpCode;
import com.tchintech.pay.model.entity.ResultBean;
import com.tchintech.pay.net.HttpRequester;
import com.tchintech.pay.utils.AppConst;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * 实名认证
 * Created by Administrator on 2017/7/7 0007.
 */

public class AuthenticationActivity extends ActivityPresenter<AuthenticationDelegate> implements View.OnClickListener {
    private final String url_Authenticate = "Merchant/authentication";
    private Map<String,String> map;

    @Override
    protected void initView() {
        super.initView();
        viewDelegate.setOnClickListener(this,R.id.identify_bt_confirm);
    }

    @Override
    protected void initData() {
        super.initData();
    }



    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.identify_bt_confirm:
                //确认信息
                setData();
                break;
        }

    }

    /**
     * 组装请求数据
     */
    private void setData(){
        String  name=viewDelegate.getString(R.id.identity_ed_trueName);
        String  smzh=viewDelegate.getString(R.id.identity_ed_IDno);
        map=new HashMap<String,String>();
        map.put("name", name);
        map.put("cardNo", smzh);
        httpPost(url_Authenticate,map,HttpCode.authentication,null);

    }
    //网路请求界面配置
   /* private void httpPost(String url, Map<String, String> map, int what ) {
        String path = HttpRequester.path(url, map);
        try {
            showProgressDialog("", "加载中，请稍后...");
            HttpRequester.post(this, what, path, map, this, null);
        } catch (Exception e) {
            hideProgressDialog();
            showMsg("网络异常");
        }
    }*/

    @Override
    public void httpCallback(String resultBean, int what) {
        super.httpCallback(resultBean, what);
        switch (what){
            case HttpCode.authentication:
                //HandPicActivity
                System.out.println("实名认证返回的数据"+resultBean);
                break;
        }
    }
    @Override
    protected Class<AuthenticationDelegate> getDelegateClass() {
        return AuthenticationDelegate.class;
    }
}
